package cn.hdu.liang.typeinfo;

import cn.hdu.liang.generics.coffee.Coffee;
import cn.hdu.liang.generics.coffee.CoffeeGenerator;
import net.mindview.util.TypeCounter;

import java.util.Iterator;

public class Exam12 {
    public static void main(String[] args) {
        TypeCounter counter = new TypeCounter(Coffee.class);
        Iterator<Coffee> it = new CoffeeGenerator(20).iterator();
        while(it.hasNext()) {
            Coffee coffee = it.next();
            System.out.print(coffee.getClass().getSimpleName() + "  ");
            counter.count(coffee);
        }
        System.out.println();
        System.out.println(counter);
    }
}
